<%@page import="Data.Member"%>
<%@page import="Data.PayType"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="Data.Category"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Data.Event"%>

<section id="content" class="gray-area">
    <div class="container car-detail-page">
        <div class="row">
            <form action="../EnrollEventPR" method="post" name="frmEvent">
                <div id="main" class="col-md-9">
                    <%
                        if (request.getParameter("EventID") != null) {
                            Event ct = new Event();
                            int eventID = Integer.parseInt(request.getParameter("EventID"));
                            ArrayList<Event> a = ct.ESelectByID(eventID);
                            if (a.size() > 0) {
                                for (int i = 0; i < a.size(); i++) {
                                    Event event = a.get(i);
                                    SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
                                    out.print("<input type='hidden' name='txtEventIDEnroll' id='txtEventIDEnroll' value='" + event.getEventID() + "' />");

                    %>

                    <div class="tab-container">
                        <ul class="tabs">
                            <li class="active">
                                <a  data-toggle="tab">EnrollEvent</a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div style="min-height: 500px;" class="tab-pane fade in active" id="car-details">
                                <!--detail-->

                                <table width='100%' border='0' style="font-size: 18px;"  cellspacing='14' cellpadding='14'>

                                    <tr>
                                        <td height="40" width='20%'>EventName:</td>
                                        <%out.print("<td>" + event.getEventName() + "</td>");%>
                                    </tr>
                                    <tr>
                                        <td height="40" width='20%'>Customer:</td>
                                        <%
                                            if (session.getAttribute("ssusercl") != null) {
                                                String user = (String) session.getAttribute("ssusercl");
                                                if (user == "") {
                                                    out.print("<td><a style='text-decoration: underline; color:#00A8FF;' href='index.jsp?page=Login'>Click here to Login</a></td>");
                                                } else {
                                                    Member mem = new Member();
                                                        ArrayList<Member> pm = mem.MselectByquery("SELECT * FROM Member where Username='"+user+"'");
                                                    if (pm.size() > 0) {
                                                        for (int im = 0; im < pm.size(); im++) {
                                                            Member paym = pm.get(im);


                                                            out.print("<td>" + paym.getMemberName() + "<input type='hidden' name='txtMemEnroll' id='txtMemEnroll' value='" + paym.getMemberID() + "' /></td>");
                                                        }
                                                    }
                                                }
                                            } else {
                                                out.print("<td><a  style='text-decoration: underline; color:#00A8FF;' href='index.jsp?page=Login'>Click here to Login</a></td>");
                                            }
                                        %>
                                    </tr>

                                    <tr>
                                        <td height="40" width='20%'>IsPayment:</td>
                                        <%out.print("<td><img style='margin-top:-3px;' src='images/No_check.png'/>  Unpaid</td>");%>
                                    </tr>

                                    <tr>
                                        <td height="40" width='20%'>Price:</td>
                                        <%
                                            if (event.getPrice() == 0.0) {
                                                out.print("<td style='color:red'>Free</td>");
                                            } else {
                                                out.print("<td style='color:red'>$" + event.getPrice() + "</td>");
                                            }
                                        %>
                                    </tr>
                                    <tr>
                                        <td height="40" width='20%'>Form of payments:</td>
                                        <td><select name="txtPay" style='font-size: 18px;   margin:0; padding:0' class="txtPay">
                                                <%
                                                    PayType pt = new PayType();
                                                    ArrayList<PayType> ap = pt.Pselect();
                                                    if (ap.size() > 0) {
                                                        for (int ip = 0; ip < ap.size(); ip++) {
                                                            PayType payty = ap.get(ip);
                                                            out.print("<option  value='" + payty.getPayID() + "'>" + payty.getPayName() + "</option>");
                                                        }
                                                    }
                                                %>

                                            </select>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td height="40" width='20%'>&nbsp;</td>
                                        <td height="40" width=''>&nbsp;</td>

                                    </tr>
                                    <tr>
                                        <td height="40" width='20%'>&nbsp;</td>
                                        <%out.print("<td><input type='submit'  style='background:  #00A8FF; border: none; width: 120px; height: 40px; color: #fff;' value='Submit' name='btnEnroll'/></td>");%>

                                    </tr>
                                </table>

                            </div>

                        </div>
                    </div>
                    <%}
                            }
                        }%>
                </div>
            </form>
            <jsp:include page="menu-right.jsp" />
        </div>
    </div>
</section>